package files

import (
	"github.com/flipped-aurora/gin-vue-admin/server/global"
	"github.com/flipped-aurora/gin-vue-admin/server/model/files"
)

type FileService struct {
}

// CreateFile 创建文件信息
func (fileService *FileService) CreateFile(file files.Files) (files.Files, error) {
	err := global.GVA_DB.Create(&file).Error
	return file, err
}

// GetJobContent 根据id获取文件信息
func (fileService *FileService) GetFile(id uint) (file files.Files, err error) {
	err = global.GVA_DB.Where("id = ?").First(&file).Error
	return file, err
}

// FindUserByIdList 根据idList获取文件信息
func (fileService *FileService) FindFileByIdList(idList []uint) (files []files.Files, err error) {
	err = global.GVA_DB.Where("id in (?)", idList).Find(&files).Error
	return files, err
}
